package com.kayt.cyberBar.cpublic.business.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.kayt.cyberBar.common.PageData;
import com.kayt.cyberBar.common.ServerResponse;
import com.kayt.cyberBar.cpublic.business.entity.po.CPublicDepart;
import com.kayt.cyberBar.cpublic.business.entity.req.vo.PublicDepartReqVO;
import com.kayt.cyberBar.cpublic.business.entity.rsp.vo.PublicDepartRspVO;
import com.kayt.cyberBar.cpublic.business.server.IPublicDepartServer;
import com.kayt.cyberBar.cpublic.business.service.IPublicDepartService;

@Service("publicDepartService")
public class PublicDepartServiceImpl implements IPublicDepartService{
	@Autowired
	private IPublicDepartServer publicDepartServer;
	@Override
	public ServerResponse<PageData<PublicDepartRspVO>> getDepartList() {
		PageData<CPublicDepart> departPageData = publicDepartServer.get_depart_list();
		return publicDepartServer.assemble_result_list(departPageData);
	}

	@Override
	public ServerResponse<PublicDepartRspVO> addDepart(PublicDepartReqVO departReqVO) {
		CPublicDepart depart = publicDepartServer.add_Depart(departReqVO);
		return publicDepartServer.assemble_result(depart);
	}

	@Override
	public ServerResponse<PublicDepartRspVO> updateDepart(PublicDepartReqVO departReqVO) {
		CPublicDepart depart = publicDepartServer.mod_depart(departReqVO);
		return publicDepartServer.assemble_result(depart);
	}

	@Override
	public ServerResponse<String> deleteDepart(String departId) {
		Integer result = publicDepartServer.del_depart(departId);
		return publicDepartServer.assemble_result_string(result);
	}
}
